package com.ml.loan.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
 * <p>
 * 操作日志
 * </p>
 *
 * @author milian
 * @since 2022-08-22
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_oper_record")
@ApiModel(value = "SysOperRecord对象", description = "操作日志")
public class SysOperRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("用户id")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty("操作模块")
    @TableField("model")
    private String model;

    @ApiModelProperty("操作方法")
    @TableField("description")
    private String description;

    @ApiModelProperty("请求地址")
    @TableField("url")
    private String url;

    @ApiModelProperty("请求方式")
    @TableField("request_method")
    private String requestMethod;

    @ApiModelProperty("调用方法")
    @TableField("oper_method")
    private String operMethod;

    @ApiModelProperty("请求参数")
    @TableField("param")
    private String param;

    @ApiModelProperty("返回结果")
    @TableField("result")
    private String result;

    @ApiModelProperty("ip地址")
    @TableField("ip")
    private String ip;

    @ApiModelProperty("备注")
    @TableField("comments")
    private String comments;

    @ApiModelProperty("请求耗时,单位毫秒")
    @TableField("spend_time")
    private Long spendTime;

    @ApiModelProperty("状态,0成功,1异常")
    @TableField("state")
    private Integer state;

    @ApiModelProperty("用户类型:0甲方，1乙方")
    @TableField("user_type")
    private Integer userType;

    @ApiModelProperty("操作时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty("修改时间")
    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @ApiModelProperty("用户账号")
    @TableField(exist = false)
    private String username;

    @ApiModelProperty("用户昵称")
    @TableField(exist = false)
    private String nickName;
}
